package com.designpatterns.observerpattern;

public class HexaObserver extends Observer
{

	// 有参构造函数
	public HexaObserver(Subject subject)
	{
		this.subject = subject;
		this.subject.attach(this);// 将当前HexaObserver添加到成员变量subject里面
	}

	// 将state转化为十六进制
	@Override
	public void update()
	{
		System.out.println("Hex String: " + Integer.toHexString(subject.getState()).toUpperCase());
	}

}
